-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Methods of const traits are const #135541
Conversation
Some changes occurred to the CTFE machinery cc @rust-lang/wg-const-eval |
hir::Constness::NotConst | ||
} | ||
} | ||
_ => hir::Constness::NotConst, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This catch all is a bit sad, but since a parent could be anything that a fn
is in, it could be a module, another fn, anything really.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
r=me
@@ -6,12 +6,16 @@ use rustc_middle::ty::TyCtxt; | |||
|
|||
fn parent_impl_constness(tcx: TyCtxt<'_>, def_id: LocalDefId) -> hir::Constness { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can u rename this to parent_impl_or_trait_constness
?
aa84e39
to
a61cd86
Compare
@bors r=compiler-errors |
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#135497 (fix typo in typenames of pin documentation) - rust-lang#135522 (add incremental test for issue 135514) - rust-lang#135523 (const traits: remove some known-bug that do not seem to make sense) - rust-lang#135535 (Add GUI test for rust-lang#135499) - rust-lang#135541 (Methods of const traits are const) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#135541 - oli-obk:push-lqlmstussztp, r=compiler-errors Methods of const traits are const Just a small FIXME that gets resolved. I think the `constness` query should not cover all const callable things
Uuh, I'm seeing a bunch of new false positives for the For example //@ run-pass
use std::ops::Add;
fn f<T: Add>(a: T, b: T) -> <T as Add>::Output {
a + b
}
fn main() {
println!("a + b is {}", f::<f32>(100f32, 200f32));
} now lints
which is not correct |
yes, the clippy lint needs to look at const stability of traits. The add trait specifically is unstably const |
Just a small FIXME that gets resolved.
I think the
constness
query should not cover all const callable things